package com.aaa.ssm.controller;

import com.aaa.ssm.entity.TmScenicDot;
import com.aaa.ssm.service.TmScenicDotService;
import com.aaa.ssm.util.Page;
import com.aaa.ssm.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping("tmscenicdot")
public class TmScenicDotController extends BaseController {
    //依赖注解
    @Resource
    private TmScenicDotService tmScenicDotService;

    //分页带参
    @PostMapping("page")
    public Result queryPage(@RequestBody Page<TmScenicDot> page){
        return success(tmScenicDotService.queryByParam(page));
    }

    //添加
    @PostMapping("add")
    public Result add(@RequestBody TmScenicDot tmScenicDot){
        return success(tmScenicDotService.add(tmScenicDot));
    }
    //更新
    @PostMapping("update")
    public Result update(@RequestBody TmScenicDot tmScenicDot){
        return success(tmScenicDotService.update(tmScenicDot));
    }
//    @PostMapping("queryScenicDotById/{id}")
//    public Result queryScenicDotById(@PathVariable("id") Integer dotid) {
//        //拿到主键id
//        Integer data = tmScenicDotService.queryScenicDotById(dotid);
//        return success(data);
//    }
    //删除
    @DeleteMapping("/{id}")
    public Result deleteById(@PathVariable String id){
        return success(tmScenicDotService.deleteById(id));
    }

}
